<template>
    <h1>登录页面</h1>

    <table>
        <tr>
            <td>用户名</td>
            <td>
                <input type="text" v-model="Name" placeholder="请输入用户名">
            </td>
        </tr>
        <tr>
            <td>密码</td>
            <td>
                <input type="password" v-model="Pwd" placeholder="请输入密码">
            </td>
        </tr>

        <tr>
            <td colspan="2">
                <input type="button" value="登录" @click="ShowUser" >
            </td>
        </tr>

    </table>

</template>

<script setup lang="ts">
import axios from "axios";
import {ref} from "vue";

const Name = ref("");
const Pwd = ref("");



const ShowUser = () => {
    axios({
        method: "get",
        url: "http://localhost:61590/api/User/ShowUser",
        params: {
            name: Name.value,
            pwd: Pwd.value
        }
    })
    .then(function (res) {
        if(res.data!=null){
            alert("登录成功");
        }
        else{
            alert("登录失败"); 
        }
    })
    .catch(function (error) {
        console.log(error);
    });
}

</script>
